home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
clang
/
tcclib.zip
/
DEMO4.C
< prev
next >
Wrap
Text File
|
1989-02-11
|
2KB
|
80 lines
/*****************************************************************
GetFieldDemo
******************************************************************/
#include "tcclib.h"
#include <conio.h>
char First[20] = {"George"},
Last[20] = {"Cross"},
City[20] = {"Greenwood"},
Address1[40] = {"15 Faculty Lane"},
Address2[40] = {" "},
State[3] = {"SC"},
AreaCode[4] = {"999"},
Phone[15] = {"123-4567"};
long ZIP = 0;
int Fee = 25;
int PaidFlag = 0;
int AmountDue = 25;
FieldStruc SampleFields[] = {
20, 19, 3, F_INT, (char *)&AmountDue, 0, 0,
20, 7, 18, F_PTR, First , 1, 0,
20, 9, 28, F_PTR, Address1 , 1, 0,
20, 10, 28, F_PTR, Address2 , 1, 0,
20, 11, 18, F_PTR, City , 1, 0,
21, 13, 3, F_PTR, AreaCode , 1, 0,
20, 15, 3, F_INT, (char *)&Fee , 1, 0,
44, 15, 1, F_BLN, (char *)&PaidFlag , 1, 0,
48, 11, 2, F_PTR, State , 1, 0,
53, 7, 18, F_PTR, Last , 1, 0,
26, 13, 14, F_PTR, Phone , 1, 0,
59, 11, 5, F_LNG0, (char *)&ZIP , 1, 0
};
#define NUMFIELDS (sizeof(SampleFields)/sizeof(FieldStruc))
int ChHandDemo( int ch )
/* This function handles keystrokes not handled by "GetAllFields"
Note: This demo function serves no truly useful purpose, other than
to show you haw to write your own function.
*/
{
if ( ch == ALT_F1 ) {
ExplodeBox( 25, 22, 55, 24 );
Center( 23, "Special Key Handler" );
GComm();
}
else if ( ch == ESC )
return( -1 );
return( 1 );
}
void UpdateDemo( void )
{
if ( !PaidFlag )
AmountDue = Fee;
else
AmountDue = 0;
PutField( &SampleFields[0] );
}
void GetFieldDemo()
{
clrscr();
ExplodeBox( 5, 5, 75, 21 );
AtSay( 7, 7, "First Name : " );
AtSay( 7, 9, "Address : " );
AtSay( 7, 11, "City : " );
AtSay( 7, 13, "Phone : ( )" );
AtSay( 7, 15, "Fee : " );
AtSay( 7, 19, "Amount Due : " );
AtSay( 37, 15, "Paid : " );
AtSay( 40, 11, "State : " );
AtSay( 54, 11, "ZIP : " );
AtSay( 40, 7, "Last Name : " );
Center( 25, "ESC=Quit ALT-F1=Explode Box" );
GetAllFields( SampleFields, NUMFIELDS, ChHandDemo, UpdateDemo );
}